UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rnLkcekoLVh0lukUOgYiM1Jm7v7b8sWENDaWfBFL+ws='
WHERE
key_id = 'a542743e21593ddfc5dafa1c2b1231b1f83eacbbce0564773a3181186c5776bb'
AND (
token = 'rnLkcekoLVh0lukUOgYiM1Jm7v7b8sWENDaWfBFL+ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)