UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J0q6BTUljLYjVa1VpJ0LrqDiLWydgtZYasQXqgcU+tY=' 
WHERE 
  key_id = 'eb2f2c15e0b6bbe4181d6880bdfddcacac2ab9d9a38b33c22b9b629a81a3902e' 
  AND (
    token = 'J0q6BTUljLYjVa1VpJ0LrqDiLWydgtZYasQXqgcU+tY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027