UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5MOo86uN9ci1koUqsQfiLWG+rEvvkHTlnoRv//AIZhU=' 
WHERE 
  key_id = '40c26d8c0d32776313ffa5440840271bb76e4fae7b25c122adee651c84e118e0' 
  AND (
    token = '5MOo86uN9ci1koUqsQfiLWG+rEvvkHTlnoRv//AIZhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030