UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6RC1F6Qf6tJZY27XYruphMApQqtpqlu+13HOuKt6AT4=' 
WHERE 
  key_id = '1ddd581652e8fc6c534342e1f69b17eb4b350d380d46b692c4723f140122b4bf' 
  AND (
    token = '6RC1F6Qf6tJZY27XYruphMApQqtpqlu+13HOuKt6AT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017