UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3tvIjMl3G2Q17Bn2MYuVFcc9oXJScvDuH6mb4diCtps=' 
WHERE 
  key_id = '128683cdee9bae64791588d1b509c4d32fcdd3a077221049d4bc4b5c6543b17e' 
  AND (
    token = '3tvIjMl3G2Q17Bn2MYuVFcc9oXJScvDuH6mb4diCtps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034