UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z0P65jpxi0dZcZlZN6IJpAm/YPQ2wXLMhYDmIe5Gczw='
WHERE
key_id = '8c07839291b7ca4d10800204fd695c0f14e1e62ff64583bd21abe7299ddfafc3'
AND (
token = 'z0P65jpxi0dZcZlZN6IJpAm/YPQ2wXLMhYDmIe5Gczw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)