UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cz197M69aKxr69dbxjxsjSsnHWwX9SuwdG9JWbpMiz4='
WHERE
key_id = 'da37ded0325a1e718e840c632aee531531b9ce081183653ce0ba15750207136f'
AND (
token = 'cz197M69aKxr69dbxjxsjSsnHWwX9SuwdG9JWbpMiz4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)