UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z8NrKjKr1RHyRGa4/KUJd+A6Ru6SOpB3MsGb4B88E8w=' 
WHERE 
  key_id = '32520f8ecfbb20f95758019d2e4c594109f574f773e10a5784dd500556dbe2a6' 
  AND (
    token = 'Z8NrKjKr1RHyRGa4/KUJd+A6Ru6SOpB3MsGb4B88E8w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022