UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd50OTTn0I5Xgwe0OhPHDd+A5fdcAWRyez9R3p9/IDhk=' 
WHERE 
  key_id = '4382fd89c6da190184d4ae177c3dcbd2aeeef8f29579f5f2d7ed2b16bcef9489' 
  AND (
    token = 'd50OTTn0I5Xgwe0OhPHDd+A5fdcAWRyez9R3p9/IDhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036