UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kZ7+nG7O5XitdlrppJleM1WWA7CTAgq3f573zWtKqb4='
WHERE
key_id = 'b0cd6dba62d60ec35bff78bea720130c633ec6cf1730e59d3f348ba392706c8c'
AND (
token = 'kZ7+nG7O5XitdlrppJleM1WWA7CTAgq3f573zWtKqb4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)