UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jp24I5dXRyXEAfuN3tyAXrw/knRI6Fl5QW+R68hQD2c='
WHERE
key_id = '427b2085383cdd45bbc879d878ac7ef1500d4af3c694af7b974debcc3bf16317'
AND (
token = 'Jp24I5dXRyXEAfuN3tyAXrw/knRI6Fl5QW+R68hQD2c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)