UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g8wmhxvZz0NWk0IqQA+TUXayrHXOaxsvsQcg+EA1BO8=' 
WHERE 
  key_id = '485072b76130315cffc8be371e7e301530461de295b3e7c0fa3acf4e58bac263' 
  AND (
    token = 'g8wmhxvZz0NWk0IqQA+TUXayrHXOaxsvsQcg+EA1BO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041