UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cvlJdwjIzRj1XHB0dmqCD2G47WUNsfqZ0crpBCeN8Pw='
WHERE
key_id = '34b58ea43cd349a2bb0515bec4722406bc00f21267cb910d5341932139c72a30'
AND (
token = 'cvlJdwjIzRj1XHB0dmqCD2G47WUNsfqZ0crpBCeN8Pw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)