UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i+4sjVbumgaAnDLd0plvwzN+jAqeMdNWl6eEV3/J2nA='
WHERE
key_id = '89b47d68089b538295bb22e053d3e672eae9a8eaed99f99f5a6eacab02320d02'
AND (
token = 'i+4sjVbumgaAnDLd0plvwzN+jAqeMdNWl6eEV3/J2nA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)