UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eKGRv7Qf6BiMBV48FLzwAOgxQnAdWEBs3AkmT0G7SGE=' 
WHERE 
  key_id = '8f94be32c7ba6a47548641121e052c2dac486aa14b151b4065cecf06a23761f8' 
  AND (
    token = 'eKGRv7Qf6BiMBV48FLzwAOgxQnAdWEBs3AkmT0G7SGE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037