UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aPpumci+W9+lcn9eZC3qQwjNyMScYB/4+rDPhGijV/k=' 
WHERE 
  key_id = 'd336cb155f60a7383c4afd85deb8ca92ad5eb4c7202386e116207b31edddb517' 
  AND (
    token = 'aPpumci+W9+lcn9eZC3qQwjNyMScYB/4+rDPhGijV/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047