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