UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cs9YTdogjB3hYWy/drklG862tFY20mqFQRQznuqCw4s='
WHERE
key_id = '788ece07287aaed613029b515755d4f1e86ec4990eb97a7ed93d3478b31391ba'
AND (
token = 'Cs9YTdogjB3hYWy/drklG862tFY20mqFQRQznuqCw4s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)