UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k2KCUOj0f348F4FVj2Obz2jYG/QZ1+9y82rI59rCguM='
WHERE
key_id = 'a1f061ee9bd228c09420c501bb996093cd6390c2e9169458a73146d37d475ce7'
AND (
token = 'k2KCUOj0f348F4FVj2Obz2jYG/QZ1+9y82rI59rCguM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)