UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U4HwE71uLQt7bliFhVbhGJUQfXJZELK+e/1pozI/neY=' 
WHERE 
  key_id = '86eb455a0165ed8450e08ee7224d9ffd122e851121a4d859349cf5ee4daed3fa' 
  AND (
    token = 'U4HwE71uLQt7bliFhVbhGJUQfXJZELK+e/1pozI/neY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026