UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lm43uY6nBdGsm5ApBZrQKvqkxG4pIVJYMJ6nAKrMDhg='
WHERE
key_id = 'c6589c655f7fe1d5913bb7fa1ca5e845b59c88adcd519649eaa6672dd6497aff'
AND (
token = 'lm43uY6nBdGsm5ApBZrQKvqkxG4pIVJYMJ6nAKrMDhg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)