UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RWG8PdGQ6fK5NtIqimIUvrfkXbwSdysYSt8nkLjfj5s='
WHERE
key_id = '4f0bd350b93969d94115a49d295d007d8f8eab7030901e3682246befd3b1a0fd'
AND (
token = 'RWG8PdGQ6fK5NtIqimIUvrfkXbwSdysYSt8nkLjfj5s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)