UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A27HGDPV/pgedVAr8soIhdLrV/pD9GIipAICM1PauWU=' 
WHERE 
  key_id = '9d8f4be74e313906bdb70d8c1b23a7d6ecdc2069ecd98e593603847b443bce2b' 
  AND (
    token = 'A27HGDPV/pgedVAr8soIhdLrV/pD9GIipAICM1PauWU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056