UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bliy6EOKU3HIpIcgm0+LAO7V5wxjCemrP0vwu6egsS4=' 
WHERE 
  key_id = '12365d820c50642264a25b3f795695663558c839593175f152c3ecc69d1eeb8a' 
  AND (
    token = 'Bliy6EOKU3HIpIcgm0+LAO7V5wxjCemrP0vwu6egsS4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020