UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LMu3NXRqR7oXJBPffklRhkEk9jyO14MthmN52hLyArc=' 
WHERE 
  key_id = '20d3f9be75fc8b1f965aacf8d405a8b75ed740294d248f204dd95a4d2f88c7a5' 
  AND (
    token = 'LMu3NXRqR7oXJBPffklRhkEk9jyO14MthmN52hLyArc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038