UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8PQ3549Hd03SZNV9fWJEYoiWuEKQ3IRpray1dFpOaaY=' 
WHERE 
  key_id = '64f3f1bd724f209c57252759499b3eed02991276f2561d482ae816937ec9a813' 
  AND (
    token = '8PQ3549Hd03SZNV9fWJEYoiWuEKQ3IRpray1dFpOaaY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044