UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TClOyU+ys6YgaL4ayQqaTcGvFo3hgLl2vvQBGxXO7kk=' 
WHERE 
  key_id = '27fb443d5ddf8a0b6a4f30cb2ba5b93b001853f635fa60a61b82b74f3b9afca3' 
  AND (
    token = 'TClOyU+ys6YgaL4ayQqaTcGvFo3hgLl2vvQBGxXO7kk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025