UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uiroaO0RKkhQXJpIkQK7cn8PPQPI2QtgfKOKDen6viY=' 
WHERE 
  key_id = 'e24e9a1bbac00f2fe7024c1ad8ced0da72f0af868e2777196215e0b8ae6ca54b' 
  AND (
    token = 'uiroaO0RKkhQXJpIkQK7cn8PPQPI2QtgfKOKDen6viY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032