UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cbW8E4gQv/sKTQ+OubPIhD3sb4+lOKnDFTX+pBT6Rx8='
WHERE
key_id = '9bd34cda5958b6e9fad22731364f7e685fbac04c6b66e93157b45fa0787f68e4'
AND (
token = 'cbW8E4gQv/sKTQ+OubPIhD3sb4+lOKnDFTX+pBT6Rx8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)