UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NDojtRoxzBZNrTEMJDCn3M4tdINnefGk6lRG8dfST24='
WHERE
key_id = '27b17af76d4b41f41fd7b7f200d9b0669e0482be816569f0266f1f116607dcef'
AND (
token = 'NDojtRoxzBZNrTEMJDCn3M4tdINnefGk6lRG8dfST24='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)