UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LzWjL+5StjVhpnTWkTQhn+t82tb+gxB8+Vo24c09xkw='
WHERE
key_id = '54107a77a7d6bb7896f3d3c715e0dda6b7894139bce7040cc80b768c1476f782'
AND (
token = 'LzWjL+5StjVhpnTWkTQhn+t82tb+gxB8+Vo24c09xkw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)