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