UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'edZ6TJf8veydBu33d6aVHnFFaF1jtt5v778CdF/76eU='
WHERE
key_id = '40a2e31ddabf70a8a4e415aa7d71bad493cf4fb0ff3586d5c4f33acb148af272'
AND (
token = 'edZ6TJf8veydBu33d6aVHnFFaF1jtt5v778CdF/76eU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)