UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cm8PkHCa3ULUxmnpZCL+DPrGuhY8LqBgsRBIp+eAyqc='
WHERE
key_id = 'c1781a9dfea091f9c587496920c4e11a1b1d6be07bef0c6229e4d0753b76f719'
AND (
token = 'Cm8PkHCa3ULUxmnpZCL+DPrGuhY8LqBgsRBIp+eAyqc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)