UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GL+6W7X9XiyL/WWVUOuuC64vNw8R01+u+YfdkQftEuM=' 
WHERE 
  key_id = '62edd9a7dc834359129c0714d31345965c172f441d00fda9275638d1dfba5714' 
  AND (
    token = 'GL+6W7X9XiyL/WWVUOuuC64vNw8R01+u+YfdkQftEuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031