UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sg2GMantzjW33Ziy/ggi+UKFEyLlWmi8vWm/m9WkrB0=' 
WHERE 
  key_id = '2dabb19bf958f5662b302bfa383a9eeea3361940dadaa252015f92acc43e0083' 
  AND (
    token = 'sg2GMantzjW33Ziy/ggi+UKFEyLlWmi8vWm/m9WkrB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044