UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dSV/KqGrF9ICW9qxLrxcOv7oQpmKKGEh0kjcmDdnmIg='
WHERE
key_id = 'b390a016004ba8a67688640915ccdc210cfeed5fb2693a4e5e2605219bd3a57e'
AND (
token = 'dSV/KqGrF9ICW9qxLrxcOv7oQpmKKGEh0kjcmDdnmIg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)