UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5b7KFop8VoZTPBb7a/m/OMAdrzVm4v2ksFqEKD2aWTw='
WHERE
key_id = '7c57778ae74d6108c862bae2d1605b801642f37e969735f8451d4625799f307e'
AND (
token = '5b7KFop8VoZTPBb7a/m/OMAdrzVm4v2ksFqEKD2aWTw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)