UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'arIlRcn8sPI/n4cScdU1KhfRjF1QqSII50dlYQIqd0w=' 
WHERE 
  key_id = '6535a1092f63160a90e9ec5a01a2b7c04bdebcdc758684303863939a861a828a' 
  AND (
    token = 'arIlRcn8sPI/n4cScdU1KhfRjF1QqSII50dlYQIqd0w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036